package gogs_hook

import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/hex"
	"strings"
)

func GenToken(secret, payload string) string {
	h := hmac.New(sha256.New, []byte(secret))
	h.Write([]byte(payload))
	token := hex.EncodeToString(h.Sum(nil))
	return strings.ToLower(token)
}
